package cn.fl.product.controller;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSONObject;

import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.DecimalUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.product.service.IPrdBscInfoService;
import cn.fl.product.service.IPrdCarInfoService;
import cn.fl.product.vo.PrdBscInfoVO;
import cn.fl.product.vo.PrdCarInfoVO;
import cn.fl.system.constant.SysLogConstant;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.product.facade.product.condition.PrdCarInfoQueryCondition;
import net.sf.json.JSONArray;

/**
 * @Description: 
 */
@Controller
@RequestMapping("/product/prdTkBusInfo")
public class PrdTkBusInfoController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(PrdTkBusInfoController.class);

	/**
	 * prdCarInfo 服务层BEAN
	 */
	@Autowired
	private IPrdCarInfoService prdCarInfoService;
	
	/**
	 * 产品进本信息服务
	 */
	@Autowired
	private IPrdBscInfoService prdBscInfoService;


	/**
	 * 到新增/修改页面
	 */
	@RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String prdId = request.getParameter("prdId");
		
		//用来刷新页面动态字段
		String bizTypCd = request.getParameter("bizTypCd");//目标代码组值(业务类型代码)
		String bizCd = request.getParameter("bizCd");//目标代码值(业务代码)
		//用来获取下拉框动态数据
		String sGrpCd = request.getParameter("sGrpCd");//源代码组值
		String sCode = request.getParameter("sCode");//源代码值
		
		ModelAndView view = new ModelAndView("product/prdTkBusInfo/prdTkBusInfoAdd");
		view.addObject("id", id);
		view.addObject("prdId", prdId);
		view.addObject("bizTypCd", bizTypCd);
		view.addObject("bizCd", bizCd);
		view.addObject("sGrpCd", sGrpCd);
		view.addObject("sCode", sCode);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到新增页面.", CurrentThreadContext.getCurrentUserName());
		
		String isShowAuditBtn = request.getParameter("isShowAuditBtn");
		view.addObject("isShowAuditBtn", isShowAuditBtn);
		return view;
	}
	/**
	 * 到新增/修改页面
	 */
	@RequestMapping(value = "/toDetailPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toDetailPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String prdId = request.getParameter("prdId");
		
		//用来刷新页面动态字段
		String bizTypCd = request.getParameter("bizTypCd");//目标代码组值(业务类型代码)
		String bizCd = request.getParameter("bizCd");//目标代码值(业务代码)
		//用来获取下拉框动态数据
		String sGrpCd = request.getParameter("sGrpCd");//源代码组值
		String sCode = request.getParameter("sCode");//源代码值
		
		ModelAndView view = new ModelAndView("product/prdTkBusInfo/prdTkBusInfoDetail");
		view.addObject("id", id);
		view.addObject("prdId", prdId);
		view.addObject("bizTypCd", bizTypCd);
		view.addObject("bizCd", bizCd);
		view.addObject("sGrpCd", sGrpCd);
		view.addObject("sCode", sCode);
		BaseLogUtils.info(logger, "toDetailPage", "跳转到详情页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prdId = request.getParameter("prdId");
		Pager page = new Pager();
		if(StringUtils.isEmpty(prdId)){
			ListPageVO<PrdCarInfoVO> listPage = new ListPageVO<PrdCarInfoVO>(new ArrayList<PrdCarInfoVO>(), 0);
			return listPage;
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrdCarInfoQueryCondition qc = new PrdCarInfoQueryCondition();
		qc.setPrdId(Long.valueOf(prdId));
		page.setCondition(qc);

		Pager pager = this.prdCarInfoService.searchListPage(page);
		List<PrdCarInfoVO> list = (List<PrdCarInfoVO>) pager.getResultList();
		ListPageVO<PrdCarInfoVO> listPage = new ListPageVO<PrdCarInfoVO>(list, pager.getTotalCount());
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(ids)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		List<Long> idsList = new ArrayList<Long>();
		JSONArray idsArray = JSONArray.fromObject(ids);
		for (Object object : idsArray) {
			idsList.add(Long.valueOf(object.toString()));
		}
		try {
			boolean success = this.prdCarInfoService.removeByIds(idsList);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DELETE_FAIL);
				BaseLogUtils.info(logger, "removeById", "删除数据失败,ID:"+ids, CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "removeById", "删除数据.[id="+ids+"]", CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+ids+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			PrdCarInfoVO vo = this.prdCarInfoService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getById", "获取数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		PrdCarInfoVO entity = new PrdCarInfoVO();
		try {
			entity = this.getRequestParamForAdd(request);
			Long id = this.prdCarInfoService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "add", "新增数据.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrdCarInfoVO entity = new PrdCarInfoVO();
		try {
			entity = this.getRequestParamForModify(request);
			entity.setId(Long.valueOf(id));
			boolean success = this.prdCarInfoService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "modify", "修改成功.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 启用卡车信息
	 */
	@RequestMapping(value = "/enable.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object enable(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_ENABLE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "enable", "启用卡车信息失败,主键参数为空.", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrdCarInfoVO prdCarInfoVO = new PrdCarInfoVO();
		prdCarInfoVO.setId(Long.valueOf(id));
		//启用
		prdCarInfoVO.setIsValid(BaseConstant.IS_YESNO_YES);
		try {
			boolean success = this.prdCarInfoService.modify(prdCarInfoVO);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_ENABLE_FAIL);
			}
			BaseLogUtils.info(logger, "enable", "启用卡车信息,ID:"+id, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "enable", "启用卡车信息失败,ID:"+id+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "enable", "启用卡车信息失败,系统错误.ID:"+id+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 禁用卡车信息
	 */
	@RequestMapping(value = "/disable.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object disable(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,SysLogConstant.LOG_CMM_DISABLE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "disable", "禁用卡车信息主键参数不存在.", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrdCarInfoVO prdCarInfoVO = new PrdCarInfoVO();
		prdCarInfoVO.setId(Long.valueOf(id));
		//禁用
		prdCarInfoVO.setIsValid(BaseConstant.IS_YESNO_NO);
		try {
			boolean success = this.prdCarInfoService.modify(prdCarInfoVO);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_DISABLE_FAIL);
			}
			BaseLogUtils.info(logger, "disable", "禁用卡车信息,ID:"+id, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "disable", "禁用卡车信息失败,ID:"+id+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "disable", "禁用卡车信息失败,系统错误.ID:"+id+".ERROR"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
	
	/**
	 * 到修改审核状态页面
	 */
	@RequestMapping(value = "/toModifyAudStsCdPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyAudStsCdPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		BaseLogUtils.info(logger, "toModifyAudStsCdPage", "加载修改审核状态页面.",CurrentThreadContext.getCurrentUserName());
		ModelAndView view = new ModelAndView("product/prdTkBusInfo/prdModifyAudStsCd");
		//审核状态
		List<KeyValueVO> searchAudStsCdList = this.prdBscInfoService.searchAudStsCdList1();
		view.addObject("searchAudStsCdList", searchAudStsCdList);
		view.addObject("id", id);
		return view;
	}
	/**
	 * 修改审核状态
	 */
	@RequestMapping(value = "/modifyAudStsCd.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO modifyAudStsCd(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String audStsCd = request.getParameter("audStsCd");
		String id = request.getParameter("id");
		String isSubmit = request.getParameter("isSubmit");
		String prdId = request.getParameter("prdId");
		if(StringUtils.isNotEmpty(isSubmit) || "1".equals(isSubmit)){
			PrdBscInfoVO prdBscInfoVO = this.prdBscInfoService.selectById(Long.valueOf(prdId));
			String audStsCd2 = prdBscInfoVO.getAudStsCd();
			if(FlowConstant.FLOW_CHECK_STATE_NON.equals(audStsCd2)){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("主产品信息未提交,请先提交出产品信息.");
				return result;
			}
		}
		if(StringUtils.isEmpty(id) || StringUtils.isEmpty(audStsCd)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modifyAudStsCd", "修改审核状态,参数不完整！", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			boolean success = this.prdCarInfoService.modifyAudStsCd(Long.valueOf(id), audStsCd, new Date(), CurrentThreadContext.getCurrentUserId());
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
			}
			BaseLogUtils.info(logger, "modifyAudStsCd", "修改审核状态,ID:"+id+".audStsCd:"+audStsCd, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modifyAudStsCd", "修改审核状态失败,ID:"+id+".audStsCd:"+audStsCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modifyAudStsCd", "修改审核状态失败,系统错误.ID:"+id+".audStsCd:"+audStsCd+".ERROR:"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}
	
	//********************私有方法********************//
	/**
	 * 获取卡车参数信息
	 * @param request
	 * @return
	 * @throws BaseException
	 */
	private PrdCarInfoVO getRequestParam(HttpServletRequest request)throws BaseException{
		String prdId = request.getParameter("prdId");//产品ID
		if (StringUtils.isBlank(prdId)) {
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "产品基本信息ID不能为空.");
		}
		String prdYr = request.getParameter("prdYr");//生产年份
		String prdCyCd = request.getParameter("prdCyCd");//国别代码
		String outVol = request.getParameter("outVol");//排量(L)
		String grboxTypCd = request.getParameter("grboxTypCd");//变速箱类型代码
		String grboxCfg = request.getParameter("grboxCfg");//变速箱配置
		String seatQtyCd = request.getParameter("seatQtyCd");//座位
		String engMdl = request.getParameter("engMdl");//发动机型号
		String drvTypCd = request.getParameter("drvTypCd");//驱动形式
		String carStrcCd = request.getParameter("carStrcCd");//车身结构
		String carStrcCfg = request.getParameter("carStrcCfg");//车身结构配置
		String powerTypCd = request.getParameter("powerTypCd");//动力方式
		String carCl = request.getParameter("carCl");//车身颜色
		String carLen = request.getParameter("carLen");//车身长度(m)
		String maxSpd = request.getParameter("maxSpd");//最高车速
		String prdWayCd = request.getParameter("prdWayCd");//生产方式
		String carMdl = request.getParameter("carMdl");//车型
		String othCfg = request.getParameter("othCfg");//其他配置
		String guidePcDouble_tkBus = request.getParameter("guidePcDouble_tkBus");//建议价格
		
		if(StringUtils.isNotEmpty(prdYr) && prdYr.length()>4){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "请填写格式为1999的年份日期.");
		}
		PrdCarInfoVO prdCarInfoVO = new PrdCarInfoVO();
		prdCarInfoVO.setPrdId(Long.valueOf(prdId));
		prdCarInfoVO.setPrdYr(prdYr);
		prdCarInfoVO.setPrdCyCd(prdCyCd);
		prdCarInfoVO.setOutVol(outVol);
		prdCarInfoVO.setGrboxTypCd(grboxTypCd);
		prdCarInfoVO.setGrboxCfg(grboxCfg);
		prdCarInfoVO.setSeatQtyCd(seatQtyCd);
		prdCarInfoVO.setEngMdl(engMdl);
		prdCarInfoVO.setDrvTypCd(drvTypCd);
		prdCarInfoVO.setCarStrcCd(carStrcCd);
		prdCarInfoVO.setCarStrcCfg(carStrcCfg);
		prdCarInfoVO.setPowerTypCd(powerTypCd);
		prdCarInfoVO.setCarCl(carCl);
		if(StringUtils.isNotEmpty(carLen)){
			prdCarInfoVO.setCarLen(Double.valueOf(carLen));
		}
		prdCarInfoVO.setMaxSpd(maxSpd);
		prdCarInfoVO.setPrdWayCd(prdWayCd);
		prdCarInfoVO.setCarMdl(carMdl);
		prdCarInfoVO.setOthCfg(othCfg);
		if(StringUtils.isNotEmpty(guidePcDouble_tkBus)){
			prdCarInfoVO.setGuidePc(DecimalUtils.convertYuanToFen(Double.valueOf(guidePcDouble_tkBus)));
		}
	
		return prdCarInfoVO;
	}
	
	/**
	 * 获取卡车请求参数(新增)
	 * @param request 请求
	 * @return 
	 */
	private PrdCarInfoVO getRequestParamForAdd(HttpServletRequest request)throws BaseException{
		PrdCarInfoVO prdCarInfoVO = this.getRequestParam(request);
		prdCarInfoVO.setCrtTm(new Date());
		prdCarInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		return prdCarInfoVO;
	}
	
	/**
	 * 获取卡车请求参数(修改)
	 * @param request 请求
	 * @return 
	 */
	private PrdCarInfoVO getRequestParamForModify(HttpServletRequest request)throws BaseException{
		PrdCarInfoVO prdCarInfoVO = this.getRequestParam(request);
		prdCarInfoVO.setMdfTm(new Date());
		prdCarInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		return prdCarInfoVO;
	}
}

